********************************************************************************
* Name			: Figure A.1 - Share allocated to child in dictator treatments,
*                 by gender of child
* Description	: This dofile shows the code used for the figure
********************************************************************************
use dataset_wide_appendix.dta, clear

preserve
keep if t1 == 1
collapse (mean) dist_child_share_mean = dist_child ///
(semean)dist_child_share_se = dist_child, by(gender_child_chosen)
gen hi = dist_child_share_mean + dist_child_share_se
gen low = dist_child_share_mean - dist_child_share_se
gen dimension = 0 if gender_child_chosen == 0
replace dimension = 1 if gender_child_chosen == 1
save HD.dta, replace
restore

preserve
keep if t4 == 1
collapse (mean) dist_child_share_mean = dist_child ///
(semean)dist_child_share_se = dist_child, by(gender_child_chosen)
gen hi = dist_child_share_mean + dist_child_share_se
gen low = dist_child_share_mean - dist_child_share_se
gen dimension = 3 if gender_child_chosen == 0
replace dimension = 4 if gender_child_chosen == 1
save WD.dta, replace
restore

clear
set more off

use "HD.dta"
append using WD.dta

preserve
twoway (bar dist_child_share_mean dimension if dimension == 0 | dimension == 3, color(gs11) barwidth(0.9)) ///
(rcap hi low dimension, lcolor(black)) || ///
(bar dist_child_share_mean dimension if dimension == 1 | dimension == 4, barwidth(0.9)) ///
(rcap hi low dimension, lcolor(black)), ///
yscale(r(0.2,0.4)) ylabel(0.0 (0.1) 0.5) ///
xlabel(0.5 "Husband Dictator" 3.5 "Wife Dictator",  noticks) ///
 xtitle("")ytitle("Mean share alloctaed to child $pm s.e.") ///
scheme(s1mono) legend(order(1 3) label(1 "Female child") label(3 "Male child") cols(2) )
restore

********************************************************************************
* Name			: Figure C.1 - Share allocated to the child, the wife, and the
*                 husband, by treatment
* Description	: This dofile shows the code used for the figure
********************************************************************************
use dataset_wide_appendix.dta, clear

preserve
keep if treatment ==1
*Child
hist dist_child, fraction discrete ytitle("Fraction", size(large)) scheme(s1mono) ///
xlabel(0(0.1) 1) width(0.1) gap(40) xtitle("Child", size(medium))
graph save childdist_hist1.gph, replace

*Husband
hist dist_husband, fraction discrete ytitle("") scheme(s1mono) ///
xlabel(0(0.1) 1)  width(0.1) gap(40) xtitle("Husband", size(medium))
graph save husb_dist1.gph, replace

*Wife
hist dist_wife, fraction discrete ytitle("") scheme(s1mono) ///
xlabel(0(0.1) 1) width(0.1) gap(40) xtitle("Wife", size(medium))
graph save wife_dist1.gph, replace

*Combine
graph combine childdist_hist1.gph  wife_dist1.gph husb_dist1.gph, row(1) ///
title("Husband Dictator") xcommon ycommon ysize(2.5) xsize(7.5)
restore

preserve
keep if treatment ==2
*Child
hist dist_child, fraction discrete ytitle("Fraction", size(large)) scheme(s1mono) ///
xlabel(0(0.1) 1) width(0.1) gap(40) xtitle("Child", size(medium))
graph save childdist_hist2.gph, replace

*Husband
hist dist_husband, fraction discrete ytitle("") scheme(s1mono) ///
xlabel(0(0.1) 1)  width(0.1) gap(40) xtitle("Husband", size(medium))
graph save husb_dist2.gph, replace

*Wife
hist dist_wife, fraction discrete ytitle("") scheme(s1mono) ///
xlabel(0(0.1) 1) width(0.1) gap(40) xtitle("Wife", size(medium))
graph save wife_dist2.gph, replace

*Combine
graph combine childdist_hist2.gph  wife_dist2.gph husb_dist2.gph, row(1) ///
title("Husband Bargaining")  xcommon ycommon ysize(2.5) xsize(7.5)
restore

preserve
keep if treatment ==3
*Child
hist dist_child, fraction discrete ytitle("Fraction", size(large)) scheme(s1mono) ///
xlabel(0(0.1) 1) width(0.1) gap(40) xtitle("Child", size(medium))
graph save childdist_hist3.gph, replace

*Husband
hist dist_husband, fraction discrete ytitle("") scheme(s1mono) ///
xlabel(0(0.1) 1)  width(0.1) gap(40) xtitle("Husband", size(medium))
graph save husb_dist3.gph, replace

*Wife
hist dist_wife, fraction discrete ytitle("") scheme(s1mono) ///
xlabel(0(0.1) 1) width(0.1) gap(40) xtitle("Wife", size(medium))
graph save wife_dist3.gph, replace

*Combine
graph combine childdist_hist3.gph  wife_dist3.gph husb_dist3.gph, row(1) ///
title("Wife Bargaining") xcommon ycommon ysize(2.5) xsize(7.5)
restore

preserve
keep if treatment ==4
*Child
hist dist_child, fraction discrete ytitle("Fraction", size(large)) scheme(s1mono) ///
xlabel(0(0.1) 1) width(0.1) gap(40) xtitle("Child", size(medium))
graph save childdist_hist4.gph, replace

*Husband
hist dist_husband, fraction discrete ytitle("") scheme(s1mono) ///
xlabel(0(0.1) 1)  width(0.1) gap(40) xtitle("Husband", size(medium))
graph save husb_dist4.gph, replace

*Wife
hist dist_wife, fraction discrete ytitle("") scheme(s1mono) ///
xlabel(0(0.1) 1) width(0.1) gap(40) xtitle("Wife", size(medium))
graph save wife_dist4.gph, replace

*Combine
graph combine childdist_hist4.gph  wife_dist4.gph husb_dist4.gph, row(1) ///
title("Wife Dictator") xcommon ycommon ysize(2.5) xsize(7.5)
restore


********************************************************************************
* Name			: Figure C.2 - Share allocated to the child, the wife, and the 
*                 husband, by treatment
* Description	: This dofile shows the code used for the figure
********************************************************************************
use dataset_wide_appendix.dta, clear
preserve
collapse (mean) dist_child_share_mean = dist_child ///
(semean)dist_child_share_se = dist_child, by(treatment)
gen hi = dist_child_share_mean + dist_child_share_se
gen low = dist_child_share_mean - dist_child_share_se

twoway (bar dist_child_share_mean treatment, barwidth(.75)) ///
(rcap hi low treatment, lcolor(black)) , ///
yscale(r(0.2,0.4)) ylabel(0.0 (0.05) 0.45)  xlabel( 1 "H Dictator" 2 "H Bargaining" 3 "W Bargaining" 4 "W Dictator" ///
) ///
 xtitle("")ytitle("Mean share allocated to child $pm s.e.") ///
scheme(s1mono) legend(off) title("Child")
restore

preserve
collapse (mean) dist_wife_share_mean = dist_wife ///
(semean)dist_wife_share_se = dist_wife, by(treatment)
gen hi = dist_wife_share_mean + dist_wife_share_se
gen low = dist_wife_share_mean - dist_wife_share_se

twoway (bar dist_wife_share_mean treatment, barwidth(.75)) ///
(rcap hi low treatment, lcolor(black)) , ///
yscale(r(0.2,0.4)) ylabel(0.0 (0.05) 0.45)  xlabel( 1 "H Dictator" 2 "H Bargaining" 3 "W Bargaining" 4 "W Dictator"  ///
) ///
 xtitle("")ytitle("Mean share allocated to wife $pm s.e.") ///
scheme(s1mono) legend(off) title("Wife")
restore

preserve
collapse (mean) dist_husband_share_mean = dist_husband ///
(semean)dist_husband_share_se = dist_husband, by(treatment)
gen hi = dist_husband_share_mean + dist_husband_share_se
gen low = dist_husband_share_mean - dist_husband_share_se

twoway (bar dist_husband_share_mean treatment, barwidth(.75)) ///
(rcap hi low treatment, lcolor(black)) , ///
yscale(r(0.2,0.4)) ylabel(0.0 (0.05) 0.45)  xlabel( 1 "H Dictator" 2 "H Bargaining" 3 "W Bargaining" 4 "W Dictator"  ///
) ///
 xtitle("")ytitle("Mean share allocated to husband $pm s.e.") ///
scheme(s1mono) legend(off) title("Husband")
restore
